package model

import (
	"context"

	"github.com/go-kratos/kratos/v2/log"
)

// GreeterRepo is a Greater model.
type (
	GreeterModel interface {
		Save(context.Context, *Greeter) (*Greeter, error)
		Update(context.Context, *Greeter) (*Greeter, error)
		FindByID(context.Context, int64) (*Greeter, error)
		ListByHello(context.Context, string) ([]*Greeter, error)
		ListAll(context.Context) ([]*Greeter, error)
	}

	greeterModel struct {
		log *log.Helper
	}
)

// NewGreeterModel
func NewGreeterModel(logger log.Logger) GreeterModel {
	return &greeterModel{
		log: log.NewHelper(logger),
	}
}

func (r *greeterModel) Save(ctx context.Context, g *Greeter) (*Greeter, error) {
	return &Greeter{
		Hello: g.Hello + " : ok",
	}, nil
}

func (r *greeterModel) Update(ctx context.Context, g *Greeter) (*Greeter, error) {
	return g, nil
}

func (r *greeterModel) FindByID(context.Context, int64) (*Greeter, error) {
	return nil, nil
}

func (r *greeterModel) ListByHello(context.Context, string) ([]*Greeter, error) {
	return nil, nil
}

func (r *greeterModel) ListAll(context.Context) ([]*Greeter, error) {
	return nil, nil
}
